﻿using System;
using System.Linq;

namespace MartinRL.ProjectEuler
{
    /// <summary>
    /// http://projecteuler.net/index.php?section=problems&id=19
    /// </summary>
    public static class Problem019
    {
         public static uint FindHowManySundaysFellOnTheFirstOfTheMonthDuringTheTwentiethCentury()
         {
             var firstDayOfThe20thCentury = new DateTime(1901, 01, 01);
             var lastDayOfThe20thCentury = new DateTime(2000, 12, 31);

             return (uint) firstDayOfThe20thCentury.To(lastDayOfThe20thCentury)
                 .Where(d => d.DayOfWeek == DayOfWeek.Sunday && d.Day == 1)
                 .Count();
         }
    }
}